<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/百度.css">
    <script src="../js/jquery-3.5.1.min.js"></script>
    <style>
        #loadingCanvas{
            position: absolute;
            top: 0;
            left: 0;
            z-index: 3;
        }
        .input-box{
            position: relative;
        }
    </style>
</head>
<body>
   
    <div id="box">
        <div class="input-box" id="logo">用户名账号登录</div>
        <div class="input-box">
            <input type="text" placeholder="手机/邮箱" name="user" id="user" >
            <p id="user-msg"></p>
        </div>
        <div class="input-box">
            <input type="password" placeholder="密码" name="pass" id="pass">
            <p id="pass-msg"></p>
        </div>
        <div class="item-box"><input type="checkbox" checked>下次自动登录</div>
        <div class="input-box">
            <button class="btn-login">登录</button>
        </div>
        <div class="a-box">
            <a href="#">忘记密码?</a>
            <a href="#" class="right-a">短信快捷登录</a>
        </div>
        <div id="oper-box">
            <a href="#" class="code">扫码登录</a>|
            <a href="#"><img src="imgs/qq.png" alt=""></a>
            <a href="#"><img src="imgs/微博.png" alt=""></a>
            <a href="register.html" class="register">立即注册</a>
        </div>
    </div>
    <script>
      $('.btn-login').click(function(){
          let username = $('#user').val();
          let userpass = $('#pass').val();
          $.ajax({
              url:'/user/login',
              success:function(data){
                  if(data.token){
                      localStorage.token= data.token;
                      location.href = "../html/学生管理.html";
                  }
              },
              type:'post',
            data:{
                username,
                userpass
            }
          })
        })
    </script>
</body>
</html>